package com.ambientrs.bot.io;

import com.ambientrs.bot.Boot;

import javax.swing.text.BadLocationException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;

public class ErrorPrinter extends PrintStream {

    public ErrorPrinter(File f) throws FileNotFoundException {
        super(f);
    }

    @Override
    public void print(boolean b) {
        print(b + "");
    }

    @Override
    public void print(char c) {
        print(c + "");
    }

    @Override
    public void print(char[] s) {
        print(new String(s));
    }

    @Override
    public void print(double d) {
        print(d + "");
    }

    @Override
    public void print(float f) {
        print(f + "");
    }

    @Override
    public void print(int i) {
        print(i + "");
    }

    @Override
    public void print(long l) {
        print(l + "");
    }

    @Override
    public void print(Object obj) {
        print(obj.toString());
    }

    @Override
    public void print(String s) {
        try {
            Boot.gui.appendToLog('\n' + s, true);
        } catch (BadLocationException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void println(boolean b) {
        println(b + "");
    }

    @Override
    public void println(char c) {
        println(c + "");
    }

    @Override
    public void println(char[] s) {
        println(new String(s));
    }

    @Override
    public void println(double d) {
        println(d + "");
    }

    @Override
    public void println(float f) {
        println(f + "");
    }

    @Override
    public void println(int i) {
        println(i + "");
    }

    @Override
    public void println(long l) {
        println(l + "");
    }

    @Override
    public void println(Object obj) {
        println(obj.toString());
    }

    @Override
    public void println(String s) {
        print(s);
    }


}
